package com.groupseven.backend.controller;

import com.groupseven.backend.configuration.WebSocket.WebSocket;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/test")
public class WebSocketController {

    @Autowired
    private WebSocket webSocket;

    @GetMapping("/sendAllWebSocket")
    public String test() {
        webSocket.sendAllMessage("清晨起来打开窗，心情美美哒~");
        System.out.println("websocket群体发送！");
        return "websocket群体发送！";
    }

    @GetMapping("/sendOneWebSocket")
    public String sendOneWebSocket() {
        webSocket.sendOneMessage("DPS007", "只要你乖给你买条gai！");
        System.out.println("websocket单人发送");
        return "websocket单人发送";
    }
}
